# Contributor: Will Sinatra <wpsinatra@gmail.com>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=lua-lume
_pkgname=lume
pkgver=2.3.0
pkgrel=1
pkgdesc="Lua functions geared towards gamedev"
url="https://github.com/rxi/lume"
arch="noarch"
license="MIT"
source="$pkgname-$pkgver.tar.gz::https://github.com/rxi/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check"

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
done

package() {
	mkdir -p "$pkgdir"
}

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	local destdir="$subpkgdir/usr/share/lua/$lver"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$pkgver-1"

	cd "$builddir"
	mkdir -p "$destdir"
	cp lume.lua "$destdir"/

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="
b0437e91465f9140a672afb98bb70b08769cd5a1a930a51e1d01c16dae0d3bd9ced4ed3272ed72282eb57ce43a9cf940135db58a28d4c5ef9a12c9fa26d3a7fc  lua-lume-2.3.0.tar.gz
"
